home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Amos / Role / Walk.AMOS / Walk.amosSourceCode < prev   
Encoding:
AMOS Source Code  |  1993-02-09  |  6.6 KB  |  359 lines

  1. Amos To Front 
  2. 'Erase 2 
  3. 'Load "DH0:AMOS/Role/ABK/Walls.ABK"
  4. Change Mouse 2
  5.  
  6. Timer=0
  7. _DIM_X=10 : _DIM_Y=10
  8. Global _DIM_X,_DIM_Y
  9.  
  10. Dim _MAP(_DIM_X,_DIM_Y)
  11. Global _MAP()
  12. For Y=0 To _DIM_Y
  13.    For X=0 To _DIM_X
  14.       Read _MAP(X,Y)
  15.    Next 
  16. Next 
  17.  
  18. Data 1,1,1,1,1,1,1,1,1,1,1
  19. Data 1,0,1,0,1,0,1,0,1,0,1
  20. Data 1,0,1,0,1,0,1,0,1,0,1
  21. Data 1,0,0,0,0,0,0,0,1,0,1
  22. Data 1,0,0,0,0,0,0,0,1,0,1
  23. Data 1,0,1,1,1,0,0,0,0,0,1
  24. Data 1,0,1,1,1,0,1,0,0,0,1
  25. Data 1,0,1,0,1,0,1,0,0,0,1
  26. Data 1,0,1,1,1,0,1,0,0,0,1
  27. Data 1,0,1,1,1,0,1,0,0,0,1
  28. Data 1,1,1,1,1,1,1,1,1,1,1
  29.  
  30. Screen Open 0,320,170,32,Lowres
  31. 'Load Iff "DH0:AMOS/role/pic/main.iff",0 
  32. Unpack 11 To 0
  33. Get Icon Palette : Colour 0,0
  34. Double Buffer 
  35. Autoback 0
  36. Update Off 
  37.  
  38.  
  39. Resource Bank 16
  40. Resource Screen Open 1,320,86,0
  41. 'Load Iff "Dh0:AMOS/role/PIC/panel.iff",1
  42. Unpack 12 To 1
  43. Screen Display 1,,220,,
  44. A$=A$+"BU 1,208,22,24,20,0,0,1;[UN 0,0,BP1+;][BR0;]"
  45. A$=A$+"BU 2,232,22,24,20,0,0,1;[UN 0,0,BP5+;][BR0;]"
  46. A$=A$+"BU 3,256,22,24,20,0,0,1;[UN 0,0,BP3+;][BR0;]"
  47. A$=A$+"BU 4,208,42,24,20,0,0,1;[UN 0,0,BP7+;][BR0;]"
  48. A$=A$+"BU 5,232,42,24,20,0,0,1;[UN 0,0,BP9+;][BR0;]"
  49. A$=A$+"BU 6,256,42,24,20,0,0,1;[UN 0,0,BP11+;][BR0;]"
  50. A$=A$+"EX;"
  51. Dialog Open 1,A$
  52. X=Dialog Run(1)
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. Make Icon Mask 
  61.  
  62. Global PP
  63. Screen 0
  64.  
  65. _LOC_X=1 : _LOC_Y=1
  66. Global _LOC_X,_LOC_Y
  67. Global KIER
  68.  
  69. _DRAW_WALLS[_LOC_X,_LOC_Y]
  70. _COMPASS
  71. Do 
  72.    
  73.    
  74.    Screen Swap : Wait Vbl 
  75.    Do 
  76.       K$=Inkey$ : SC=Scancode : D=Dialog(1)
  77.       '
  78.       If(SC=76 or D=2) and _LOC_Y-1>0 and _MAP(_LOC_X,_LOC_Y-1)=0
  79.          Dec _LOC_Y : Exit 
  80.       Else If SC=76 or D=2
  81.          _SOUND[1]
  82.       End If 
  83.       If(SC=77 or D=5) and _LOC_Y+1<_DIM_Y and _MAP(_LOC_X,_LOC_Y+1)=0
  84.          Inc _LOC_Y : Exit 
  85.       Else If SC=77 or D=5
  86.          _SOUND[1]
  87.       End If 
  88.       If(SC=78 or D=6) and _LOC_X+1<_DIM_X and _MAP(_LOC_X+1,_LOC_Y)=0
  89.          Inc _LOC_X : Exit 
  90.       Else If SC=78 or D=6
  91.          _SOUND[1]
  92.       End If 
  93.       If(SC=79 or D=4) and _LOC_X-1>0 and _MAP(_LOC_X-1,_LOC_Y)=0
  94.          Dec _LOC_X : Exit 
  95.       Else If SC=79 or D=4
  96.          _SOUND[1]
  97.       End If 
  98.       '
  99.       If SC=95 or D=3 : _ROTATE_RIGHT : _COMPASS : End If 
  100.       If SC=70 or D=1 : _ROTATE_LEFT : _COMPASS : End If 
  101.       '
  102.       If SC=80 : Screen 0 : Save Iff "trash:Pic"+Str$(PP),1 : Inc PP : End If 
  103.       
  104.       If Timer>6000 : Stop : End If 
  105.    Loop 
  106.    
  107.    Proc _DRAW_WALLS[_LOC_X,_LOC_Y]
  108. Loop 
  109.  
  110.  
  111.  
  112. Procedure _DRAW_WALLS[X,Y]
  113.    '
  114.    NB=14
  115.    
  116.    If KIER mod 2=0
  117.    If X mod 2=0 : OFF_1=NB : OFF_2=0 : Else OFF_1=0 : OFF_2=NB : End If 
  118.    If Y mod 2=0 : OFF_3=NB : OFF_4=0 : Else OFF_3=0 : OFF_4=NB : End If 
  119.       No Icon Mask 13
  120.       Paste Icon 14,14,13
  121.    Else 
  122.    If X mod 2=0 : OFF_1=0 : OFF_2=NB : Else OFF_1=NB : OFF_2=0 : End If 
  123.    If Y mod 2=0 : OFF_3=0 : OFF_4=NB : Else OFF_3=NB : OFF_4=0 : End If 
  124.       No Icon Mask 14
  125.       Paste Icon 14,14,14
  126.    End If 
  127.    '
  128.    
  129.    '   If(X+Y) mod 2=0
  130.    '    
  131.    '   Else 
  132.    
  133.    '   End If 
  134.    
  135.    '
  136.    ' 1
  137.    '
  138.    If X>1 and Y>3
  139.       If _MAP(X-2,Y-4)=1
  140.          Paste Icon 14,43,2+OFF_1
  141.       End If 
  142.    End If 
  143.    '
  144.    ' 2
  145.    '
  146.    If X>0 and Y>3
  147.       If _MAP(X-1,Y-4)=1
  148.          Paste Icon 35,43,1+OFF_2
  149.       End If 
  150.    End If 
  151.    '
  152.    ' 3  
  153.    '
  154.    If Y>3
  155.       If _MAP(X,Y-4)=1
  156.          Paste Icon 80,43,1+OFF_1
  157.       End If 
  158.    End If 
  159.    '
  160.    ' 4
  161.    '
  162.    If X<_DIM_X and Y>3
  163.       If _MAP(X+1,Y-4)=1
  164.          Paste Icon 125,43,1+OFF_2
  165.       End If 
  166.    End If 
  167.    '
  168.    ' 5
  169.    '
  170.    If X<_DIM_X-1 and Y>3
  171.       If _MAP(X+2,Y-4)=1
  172.          Paste Icon 170,43,2+OFF_1
  173.       End If 
  174.    End If 
  175.    '
  176.    ' 6  
  177.    '
  178.    If X>1 and Y>2
  179.       If _MAP(X-2,Y-3)=1
  180.          Paste Icon 4,40,Hrev(7+OFF_3)
  181.       End If 
  182.    End If 
  183.    '
  184.    ' 7
  185.    '
  186.    If X>0 and Y>2
  187.       If _MAP(X-1,Y-3)=1
  188.          Paste Icon 14,40,3+OFF_2
  189.          Paste Icon 65,40,Hrev(6+OFF_3)
  190.       End If 
  191.    End If 
  192.    '
  193.    ' 8
  194.    '
  195.    If X<_DIM_X-2 and Y>2
  196.       If _MAP(X+2,Y-3)=1
  197.          Paste Icon 170,40,7+OFF_3
  198.       End If 
  199.    End If 
  200.    '
  201.    ' 9
  202.    '
  203.    If X<_DIM_X and Y>2
  204.       If _MAP(X+1,Y-3)=1
  205.          Paste Icon 132,40,3+OFF_2
  206.          Paste Icon 125,40,6+OFF_3
  207.       End If 
  208.    End If 
  209.    '
  210.    ' 10 
  211.    '  
  212.    If Y>2
  213.       If _MAP(X,Y-3)=1
  214.          Paste Icon 73,40,3+OFF_1
  215.       End If 
  216.    End If 
  217.    '
  218.    ' 11   
  219.    '
  220.    If X>0 and Y>1
  221.       If _MAP(X-1,Y-2)=1
  222.          Paste Icon 14,33,5+OFF_2
  223.          Paste Icon 42,33,Hrev(8+OFF_4)
  224.       End If 
  225.    End If 
  226.    '
  227.    ' 12 
  228.    '
  229.    If X<_DIM_X and Y>1
  230.       If _MAP(X+1,Y-2)=1
  231.          Paste Icon 148,33,5+OFF_2
  232.          Paste Icon 132,33,8+OFF_4
  233.       End If 
  234.    End If 
  235.    '
  236.    ' 13 
  237.    '
  238.    If Y>1
  239.       If _MAP(X,Y-2)=1
  240.          Paste Icon 57,33,4+OFF_1
  241.       End If 
  242.    End If 
  243.    '    
  244.    ' 14 
  245.    '
  246.    If X>0 and Y>0
  247.       If _MAP(X-1,Y-1)=1
  248.          Paste Icon 26,20,Hrev(9+OFF_3)
  249.          If _MAP(X-1,Y)=0 : Paste Icon 14,20,11+OFF_2 : End If 
  250.          If _MAP(X-1,Y)=1 : Paste Icon 13,14,Hrev(10+OFF_4) : End If 
  251.       End If 
  252.    End If 
  253.    '    
  254.    ' 15 
  255.    '
  256.    If X<_DIM_X and Y>0
  257.       If _MAP(X+1,Y-1)=1
  258.          Paste Icon 148,20,9+OFF_3
  259.          If _MAP(X+1,Y)=0 : Paste Icon 177,20,11+OFF_2 : End If 
  260.          If _MAP(X+1,Y)=1 : Paste Icon 177,14,10+OFF_4 : End If 
  261.       End If 
  262.    End If 
  263.    '
  264.    ' 16 
  265.    '
  266.    If _MAP(X,Y-1)=1 : Paste Icon 28,20,12+OFF_1 : End If 
  267.    '  
  268.    ' 17 
  269.    '
  270.    If _MAP(X-1,Y)=1 : Paste Icon 13,14,Hrev(10+OFF_4) : End If 
  271.    '
  272.    ' 18 
  273.    '
  274.    If _MAP(X+1,Y)=1 : Paste Icon 177,14,10+OFF_4 : End If 
  275.    '
  276.    '
  277. End Proc
  278. Procedure _ROTATE_RIGHT
  279.    Dim _NOW(10,10)
  280.    '
  281.    '
  282.    '
  283.    For X=0 To 10
  284.       For Y=10 To 0 Step -1
  285.          _NOW(X,Y)=_MAP(10-Y,X)
  286.       Next Y
  287.    Next X
  288.    '  
  289.    For X=0 To 10
  290.       For Y=0 To 10
  291.          _MAP(X,Y)=_NOW(X,Y)
  292.       Next Y
  293.    Next X
  294.    '
  295.    '
  296.    '  
  297.    Add KIER,1,0 To 3
  298.    
  299.    N_LOC_X=_LOC_Y
  300.    N_LOC_Y=10-_LOC_X
  301.    
  302.    _LOC_X=N_LOC_X
  303.    _LOC_Y=N_LOC_Y
  304.    
  305.    Proc _DRAW_WALLS[_LOC_X,_LOC_Y]
  306.    Screen Swap : Wait Vbl 
  307. End Proc
  308. Procedure _ROTATE_LEFT
  309.    
  310.    Dim _NOW(10,10)
  311.    
  312.    
  313.    
  314.    For X=0 To 10
  315.       For Y=10 To 0 Step -1
  316.          _NOW(10-Y,X)=_MAP(X,Y)
  317.       Next Y
  318.    Next X
  319.    
  320.    For X=0 To 10
  321.       For Y=0 To 10
  322.          _MAP(X,Y)=_NOW(X,Y)
  323.       Next Y
  324.    Next X
  325.    
  326.    
  327.    
  328.    Add KIER,-1,0 To 3
  329.    
  330.    N_LOC_X=10-_LOC_Y
  331.    N_LOC_Y=_LOC_X
  332.    
  333.    _LOC_X=N_LOC_X
  334.    _LOC_Y=N_LOC_Y
  335.    
  336.    Proc _DRAW_WALLS[_LOC_X,_LOC_Y]
  337.    Screen Swap : Wait Vbl 
  338. End Proc
  339.  
  340. Procedure _COMPASS
  341.    
  342.    Screen 1
  343.    Gr Writing 1 : Ink 0
  344.    If KIER=0 : T1$="W" : T2$="N" : T3$="E" : End If 
  345.    If KIER=1 : T1$="N" : T2$="E" : T3$="S" : End If 
  346.    If KIER=2 : T1$="E" : T2$="S" : T3$="W" : End If 
  347.    If KIER=3 : T1$="S" : T2$="W" : T3$="N" : End If 
  348.    
  349.    Text 27,18,T1$
  350.    Text 47,18,T2$
  351.    Text 67,18,T3$
  352.    Screen 0
  353. End Proc
  354.  
  355. Procedure _SOUND[CH]
  356.    Wave 1 To %1010
  357.    Bell 12
  358.    
  359. End Proc